#!/bin/bash
# 检查磁盘空间并发送邮件
threshold=80  # 阈值百分比
email="admin@example.com"
used=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
if [ $used -ge $threshold ]
then  
echo "磁盘空间警告：已使用 $used%" | mail -s "磁盘空间警告" $email
fi